/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package kn.cstf2.implementation.Client;

import kn.cstf2.cop.Bean.CopBean;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Map;
import java.util.logging.Level;
import kn.cstf2.global.Utils.ConexionFtp;
import kn.cstf2.global.Utils.CstF2Exception;
import kn.cstf2.implementation.Bean.*;
import kn.cstf2.implementation.Shared.ImplementationShared;
import kn.cstf2.main.Shared.MainShared;
import kn.cstf2.transition.Bean.AsignIfownerStkBean;
import kn.cstf2.transition.Bean.TransitionBean;
import kn.cstf2.transition.Client.TransitionClient;
import kn.cstf2.transition.Shared.TransitionShared;
import kn.mx.cstf2.dto.UsuarioDto;

import org.apache.log4j.Logger;

/**
 *
 * @author user1
 */
public class ImplementationAction extends ActionSupport {

    private static Logger log = Logger.getLogger(TransitionClient.class);
    public static final String ERROR_SESSION = "errorSession";
    public static final String ERROR_KNKEY = "errorKnkey";
    private ArrayList<String> statusList = new ArrayList<String>();
    private String status = new String();
    private TransitionBean transitionBeanM = new TransitionBean();
    private TransitionBean transitionBean = new TransitionBean();
    private String ClientInfo = new String();
    private String CorreoIfOwnerInfo = new String();
    private Boolean exporta;
    private Boolean carrierChoise;
    private Boolean cielQuotationStatus;

    public Boolean getCarrierChoise() {
        return carrierChoise;
    }

    public void setCarrierChoise(Boolean carrierChoise) {
        this.carrierChoise = carrierChoise;
    }

    public Boolean getCielQuotationStatus() {
        return cielQuotationStatus;
    }

    public void setCielQuotationStatus(Boolean cielQuotationStatus) {
        this.cielQuotationStatus = cielQuotationStatus;
    }

    public Boolean getExporta() {
        return exporta;
    }

    public void setExporta(Boolean exporta) {
        this.exporta = exporta;
    }
    private DateStatusTransitionsBean dateStatusTransitionsBean = new DateStatusTransitionsBean();
    private DateStatusTransitionsBean dateBean = new DateStatusTransitionsBean();
    private JoindocumenttransitionBean joindocumenttransitionBeanT1 = new JoindocumenttransitionBean();
    private JoindocumenttransitionBean joindocumenttransitionBeanT2 = new JoindocumenttransitionBean();
    private JoindocumenttransitionBean joindocumenttransitionBeanT3 = new JoindocumenttransitionBean();
    private JoindocumenttransitionBean joindocumenttransitionBeanT4 = new JoindocumenttransitionBean();
    private JoindocumenttransitionBean joindocumenttransitionBeanT5 = new JoindocumenttransitionBean();
    private JoindocumenttransitionBean joindocumenttransitionBeanT6 = new JoindocumenttransitionBean();
    private JoindocumenttransitionBean joindocumenttransitionBeanT7 = new JoindocumenttransitionBean();
    private JoindocumenttransitionBean joindocumenttransitionBeanT8 = new JoindocumenttransitionBean();
    private TransitionsBeanImp transitionsBeanImp;

    public ImplementationAction() {
        transitionsBeanImp = new TransitionsBeanImp();
    }

    public TransitionsBeanImp getTransitionsBeanImp() {
        return transitionsBeanImp;
    }

    public void setTransitionsBeanImp(TransitionsBeanImp transitionsBeanImp) {
        this.transitionsBeanImp = transitionsBeanImp;
    }

    public JoindocumenttransitionBean getJoindocumenttransitionBeanT1() {
        return joindocumenttransitionBeanT1;
    }

    public void setJoindocumenttransitionBeanT1(JoindocumenttransitionBean joindocumenttransitionBeanT1) {
        this.joindocumenttransitionBeanT1 = joindocumenttransitionBeanT1;
    }

    public JoindocumenttransitionBean getJoindocumenttransitionBeanT2() {
        return joindocumenttransitionBeanT2;
    }

    public void setJoindocumenttransitionBeanT2(JoindocumenttransitionBean joindocumenttransitionBeanT2) {
        this.joindocumenttransitionBeanT2 = joindocumenttransitionBeanT2;
    }

    public JoindocumenttransitionBean getJoindocumenttransitionBeanT3() {
        return joindocumenttransitionBeanT3;
    }

    public void setJoindocumenttransitionBeanT3(JoindocumenttransitionBean joindocumenttransitionBeanT3) {
        this.joindocumenttransitionBeanT3 = joindocumenttransitionBeanT3;
    }

    public JoindocumenttransitionBean getJoindocumenttransitionBeanT4() {
        return joindocumenttransitionBeanT4;
    }

    public void setJoindocumenttransitionBeanT4(JoindocumenttransitionBean joindocumenttransitionBeanT4) {
        this.joindocumenttransitionBeanT4 = joindocumenttransitionBeanT4;
    }

    public JoindocumenttransitionBean getJoindocumenttransitionBeanT5() {
        return joindocumenttransitionBeanT5;
    }

    public void setJoindocumenttransitionBeanT5(JoindocumenttransitionBean joindocumenttransitionBeanT5) {
        this.joindocumenttransitionBeanT5 = joindocumenttransitionBeanT5;
    }

    public JoindocumenttransitionBean getJoindocumenttransitionBeanT6() {
        return joindocumenttransitionBeanT6;
    }

    public void setJoindocumenttransitionBeanT6(JoindocumenttransitionBean joindocumenttransitionBeanT6) {
        this.joindocumenttransitionBeanT6 = joindocumenttransitionBeanT6;
    }

    public JoindocumenttransitionBean getJoindocumenttransitionBeanT7() {
        return joindocumenttransitionBeanT7;
    }

    public void setJoindocumenttransitionBeanT7(JoindocumenttransitionBean joindocumenttransitionBeanT7) {
        this.joindocumenttransitionBeanT7 = joindocumenttransitionBeanT7;
    }

    public JoindocumenttransitionBean getJoindocumenttransitionBeanT8() {
        return joindocumenttransitionBeanT8;
    }

    public void setJoindocumenttransitionBeanT8(JoindocumenttransitionBean joindocumenttransitionBeanT8) {
        this.joindocumenttransitionBeanT8 = joindocumenttransitionBeanT8;
    }

    public DateStatusTransitionsBean getDateStatusTransitionsBean() {
        return dateStatusTransitionsBean;
    }

    public void setDateStatusTransitionsBean(DateStatusTransitionsBean dateStatusTransitionsBean) {
        this.dateStatusTransitionsBean = dateStatusTransitionsBean;
    }

    public DateStatusTransitionsBean getDateBean() {
        return dateBean;
    }

    public void setDateBean(DateStatusTransitionsBean dateBean) {
        this.dateBean = dateBean;
    }

    public String getClientInfo() {
        return ClientInfo;
    }

    public void setClientInfo(String ClientInfo) {
        this.ClientInfo = ClientInfo;
    }

    public String getCorreoIfOwnerInfo() {
        return CorreoIfOwnerInfo;
    }

    public void setCorreoIfOwnerInfo(String CorreoIfOwnerInfo) {
        this.CorreoIfOwnerInfo = CorreoIfOwnerInfo;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public ArrayList<String> getStatusList() {
        return statusList;
    }

    public void setStatusList(ArrayList<String> statusList) {
        this.statusList = statusList;
    }
    private String statusselected;
    private String statusImplemSelected;

    public String getStatusImplemSelected() {
        return statusImplemSelected;
    }

    public void setStatusImplemSelected(String statusImplemSelected) {
        this.statusImplemSelected = statusImplemSelected;
    }

    public String getStatusselected() {
        return statusselected;
    }

    public void setStatusselected(String statusselected) {
        this.statusselected = statusselected;
    }
    private ArrayList<TransitionBean> transitionBeanArray;

    public ArrayList<TransitionBean> getTransitionBeanArray() {
        return transitionBeanArray;
    }

    public void setTransitionBeanArray(ArrayList<TransitionBean> transitionBeanArray) {
        this.transitionBeanArray = transitionBeanArray;
    }

    public String execute() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            if (transitionBeanM.getKnkey() == null) {
                CstF2Exception ex = new CstF2Exception();
                log.error("ERROR. ", ex);
                addFieldError("Not Knkey Found", "PorFavor Seleccione una Knkey: " + ex.getMessage());
                MainShared mainShared = new MainShared();
                setTransitionBeanArray(mainShared.GetTransitionBeanArrayIdKnkey(usuario));

                return ERROR_KNKEY;
            }

            statusList.add("On Hold");
            statusList.add("On Going");
            statusList.add("Canceled");
            statusList.add("Closed");
            statusList.add("Completed");

            TransitionShared transitionShared = new TransitionShared();
            ImplementationShared implementationShared = new ImplementationShared();

            setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
            AsignIfownerStkBean hghg = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
            if (hghg != null) {
                setCorreoIfOwnerInfo(hghg.getIfownwer());
            }

            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;
            setDateStatusTransitionsBean(implementationShared.GetDateOfStatusTransitions(transitionBeanM.getId()));
            dateBean = implementationShared.GetFechaOfStatusTransitions(transitionBeanM.getId());

            statusselected = transitionShared.GetStatusSelected(transitionBeanM.getKnkey());
            statusImplemSelected = transitionShared.GetStatusImplementationSelected(transitionBeanM.getKnkey());



            setJoindocumenttransitionBeanT1(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 1));
            setJoindocumenttransitionBeanT2(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 2));
            setJoindocumenttransitionBeanT3(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 3));
            setJoindocumenttransitionBeanT4(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 4));
            setJoindocumenttransitionBeanT5(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 5));
            setJoindocumenttransitionBeanT6(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 6));
            setJoindocumenttransitionBeanT7(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 7));
            setJoindocumenttransitionBeanT8(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 8));

            setTransitionsBeanImp(implementationShared.GetAllRestInforT_transition(transitionBeanM.getId()));
        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        return SUCCESS;
    }

    public String AllDataClient() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            statusList.add("On Hold");
            statusList.add("On Going");
            statusList.add("Canceled");
            statusList.add("Closed");
            statusList.add("Completed");

            TransitionShared transitionShared = new TransitionShared();

            setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
            AsignIfownerStkBean hghg = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
            if (hghg != null) {
                setCorreoIfOwnerInfo(hghg.getIfownwer());
            }

            ClienteStkBean clienteStkBean = new ClienteStkBean();
            T_asignStkBean t_asignStkBean = new T_asignStkBean();

            ImplementationShared implementationShared = new ImplementationShared();

            clienteStkBean = implementationShared.GetAllDataFromClientesSTK(transitionBeanM.getKnkey());

            t_asignStkBean = implementationShared.GetIfOwnerFromSTK(transitionBeanM.getKnkey());

        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        return SUCCESS;
    }

    public String GetStatusFechaArchivoFromJoindocumenttransition() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            statusList.add("On Hold");
            statusList.add("On Going");
            statusList.add("Canceled");
            statusList.add("Closed");
            statusList.add("Completed");

            TransitionShared transitionShared = new TransitionShared();

            setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
            AsignIfownerStkBean hghg = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
            if (hghg != null) {
                setCorreoIfOwnerInfo(hghg.getIfownwer());
            }

            TransitionBean transitionBeanNew = new TransitionBean();

            ImplementationShared implementationShared = new ImplementationShared();
            JoindocumenttransitionBean joindocumenttransitionBean = new JoindocumenttransitionBean();

            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);

            DocumentsBean documentsBean = new DocumentsBean();
            documentsBean = implementationShared.GetIdFromDocuments();


            joindocumenttransitionBean = implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanNew.getId(), documentsBean.getId());

        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        return SUCCESS;
    }

    public String GetAllRestInforT_transition() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            statusList.add("On Hold");
            statusList.add("On Going");
            statusList.add("Canceled");
            statusList.add("Closed");
            statusList.add("Completed");

            TransitionShared transitionShared = new TransitionShared();

            setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
            AsignIfownerStkBean hghg = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
            if (hghg != null) {
                setCorreoIfOwnerInfo(hghg.getIfownwer());
            }

            TransitionBean transitionBeanNew = new TransitionBean();

            ImplementationShared implementationShared = new ImplementationShared();
            JoindocumenttransitionBean joindocumenttransitionBean = new JoindocumenttransitionBean();

            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            TransitionsBeanImp transitionsBeanImp = new TransitionsBeanImp();
            transitionsBeanImp = implementationShared.GetAllRestInforT_transition(transitionBeanNew.getId());

        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        return SUCCESS;
    }

    public String InsertStatusImplementation() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

//        statusList.add("On Hold");
//        statusList.add("On Going");
//        statusList.add("Canceled");
//        statusList.add("Closed");

            TransitionShared transitionShared = new TransitionShared();

            setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
            AsignIfownerStkBean hghg = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
            if (hghg != null) {
                setCorreoIfOwnerInfo(hghg.getIfownwer());
            }

            TransitionBean transitionBeanNew = new TransitionBean();

            ImplementationShared implementationShared = new ImplementationShared();
            JoindocumenttransitionBean joindocumenttransitionBean = new JoindocumenttransitionBean();

            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBean = transitionBeanNew;

            transitionBean.setStatus(status);

            transitionShared.UpdateStatusEnImplementation(transitionBean);

            execute();

        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        return SUCCESS;
    }

    public String UpdateStatusDocumentsCielID() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            statusList.add("On Hold");
            statusList.add("On Going");
            statusList.add("Canceled");
            statusList.add("Closed");
            statusList.add("Completed");

            TransitionShared transitionShared = new TransitionShared();
            setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
            AsignIfownerStkBean hghg = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
            if (hghg != null) {
                setCorreoIfOwnerInfo(hghg.getIfownwer());
            }

            TransitionBean transitionBeanNew = new TransitionBean();
            ImplementationShared implementationShared = new ImplementationShared();
            JoindocumenttransitionBean joindocumenttransitionBean = new JoindocumenttransitionBean();

            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;

            TransitionsBeanImp transitionsBeanImp = new TransitionsBeanImp();
            Date myfechamehodDate = transitionShared.GetTheDateTime();
            DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
            java.sql.Date date = null;
            //myfechamehodDate= dateFormat.format(myfechamehodDate);

            date = convertToSqlDate(myfechamehodDate);

            if (transitionsBeanImp.getCielid() == null) {
                transitionsBeanImp.setCielid(false);
            }
            //transitionsBeanImp=implementationShared.UpdateStatusDocumentsCielID(transitionBeanM.getId(), transitionsBeanImp.getCielid(), date);


            execute();
        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        return SUCCESS;
    }

    public String UpdateStatusDocumentsCarrier() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            statusList.add("On Hold");
            statusList.add("On Going");
            statusList.add("Canceled");
            statusList.add("Closed");
            statusList.add("Completed");

            TransitionShared transitionShared = new TransitionShared();

            setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
            AsignIfownerStkBean hghg = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
            if (hghg != null) {
                setCorreoIfOwnerInfo(hghg.getIfownwer());
            }

            TransitionBean transitionBeanNew = new TransitionBean();

            ImplementationShared implementationShared = new ImplementationShared();
            JoindocumenttransitionBean joindocumenttransitionBean = new JoindocumenttransitionBean();

            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBean = transitionBeanNew;

            transitionBean.setStatus(status);

            transitionShared.UpdateStatusEnTransition(transitionBean);

            TransitionsBeanImp transitionsBeanImp = new TransitionsBeanImp();
            Date myfechamehodDate = transitionShared.GetTheDateTime();
            DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
            java.sql.Date date = null;
            //myfechamehodDate= dateFormat.format(myfechamehodDate);

            date = convertToSqlDate(myfechamehodDate);
            if (transitionsBeanImp.getCarriercc() == null) {
                transitionsBeanImp.setCarriercc(false);
            }
            //transitionsBeanImp=implementationShared.UpdateStatusDocumentsCarrier(transitionBeanM.getId(), transitionsBeanImp.getCielid(), date);

            setDateStatusTransitionsBean(implementationShared.GetDateOfStatusTransitions(transitionBean.getId()));
            dateBean = implementationShared.GetFechaOfStatusTransitions(transitionBeanM.getId());


        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        return SUCCESS;
    }

    public String impleJsp() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            statusList.add("On Hold");
            statusList.add("On Going");
            statusList.add("Canceled");
            statusList.add("Closed");
            statusList.add("Completed");

            TransitionShared transitionShared = new TransitionShared();

            setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
            AsignIfownerStkBean hghg = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
            if (hghg != null) {
                setCorreoIfOwnerInfo(hghg.getIfownwer());
            }


        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }

        return SUCCESS;
    }

    public String InsertVoboCheckBox() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            TransitionShared transitionShared = new TransitionShared();
            ImplementationShared implementationShared = new ImplementationShared();

            setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
            AsignIfownerStkBean hghg = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
            if (hghg != null) {
                setCorreoIfOwnerInfo(hghg.getIfownwer());
            }

            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;

            setJoindocumenttransitionBeanT1(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 1));
            setJoindocumenttransitionBeanT2(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 2));
            setJoindocumenttransitionBeanT3(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 3));
            setJoindocumenttransitionBeanT4(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 4));
            setJoindocumenttransitionBeanT5(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 5));
            setJoindocumenttransitionBeanT6(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 6));
            setJoindocumenttransitionBeanT7(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 7));
            setJoindocumenttransitionBeanT8(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 8));

            Date myfechamehodDate = transitionShared.GetTheDateTime();
            DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
            //myfechamehodDate= dateFormat.format(myfechamehodDate);  
            String fechaCielID = dateFormat.format(myfechamehodDate);
            


            if (transitionsBeanImp.getCielid() == null) {
                transitionsBeanImp.setCielid(false);
            }
            TransitionsBeanImp tbdate = new TransitionsBeanImp();
            Date cieliddate = new Date();
            tbdate = implementationShared.UpdateStatusDocumentsCielID(transitionBeanM.getId(), transitionsBeanImp.getCielid(), fechaCielID, dateBean.getCieliddate());
            transitionsBeanImp.setCieliddate(tbdate.getCieliddate());

            setDateStatusTransitionsBean(implementationShared.GetDateOfStatusTransitions(transitionBeanM.getId()));
            setTransitionsBeanImp(implementationShared.GetAllRestInforT_transition(transitionBeanM.getId()));
            dateBean = implementationShared.GetFechaOfStatusTransitions(transitionBeanM.getId());

            execute();

        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        return SUCCESS;
    }

    public static java.sql.Date convertToSqlDate(java.util.Date oDate) {
        return (new java.sql.Date(oDate.getTime()));
    }
    
    public String InsertVoboCheckBox1() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            TransitionShared transitionShared = new TransitionShared();
            ImplementationShared implementationShared = new ImplementationShared();

            setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
            AsignIfownerStkBean hghg = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
            if (hghg != null) {
                setCorreoIfOwnerInfo(hghg.getIfownwer());
            }

            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;

            setJoindocumenttransitionBeanT1(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 1));
            setJoindocumenttransitionBeanT2(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 2));
            setJoindocumenttransitionBeanT3(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 3));
            setJoindocumenttransitionBeanT4(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 4));
            setJoindocumenttransitionBeanT5(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 5));
            setJoindocumenttransitionBeanT6(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 6));
            setJoindocumenttransitionBeanT7(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 7));
            setJoindocumenttransitionBeanT8(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 8));

            Date myfechamehodDate = transitionShared.GetTheDateTime();
            DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
            //myfechamehodDate= dateFormat.format(myfechamehodDate);  
            String fecha = dateFormat.format(myfechamehodDate);


            if (transitionsBeanImp.getCop()== null) {
                transitionsBeanImp.setCop(false);
            }
            
            TransitionsBeanImp tbdate = new TransitionsBeanImp();
            Date cieliddate = new Date();
            tbdate = implementationShared.UpdateStatusDocumentsCop(transitionBeanM.getId(), transitionsBeanImp.getCop(), fecha, dateBean.getCopdate());
            transitionsBeanImp.setCopdate(tbdate.getCopdate());

            setDateStatusTransitionsBean(implementationShared.GetDateOfStatusTransitions(transitionBeanM.getId()));
            setTransitionsBeanImp(implementationShared.GetAllRestInforT_transition(transitionBeanM.getId()));
            dateBean = implementationShared.GetFechaOfStatusTransitions(transitionBeanM.getId());

            execute();

        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        return SUCCESS;
    }
    
    public String InsertVoboCheckBox2() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            TransitionShared transitionShared = new TransitionShared();
            ImplementationShared implementationShared = new ImplementationShared();

            setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
            AsignIfownerStkBean hghg = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
            if (hghg != null) {
                setCorreoIfOwnerInfo(hghg.getIfownwer());
            }

            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;

            setJoindocumenttransitionBeanT1(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 1));
            setJoindocumenttransitionBeanT2(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 2));
            setJoindocumenttransitionBeanT3(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 3));
            setJoindocumenttransitionBeanT4(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 4));
            setJoindocumenttransitionBeanT5(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 5));
            setJoindocumenttransitionBeanT6(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 6));
            setJoindocumenttransitionBeanT7(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 7));
            setJoindocumenttransitionBeanT8(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 8));

            Date myfechamehodDate = transitionShared.GetTheDateTime();
            DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
            //myfechamehodDate= dateFormat.format(myfechamehodDate);  
            String fecha = dateFormat.format(myfechamehodDate);


            if (transitionsBeanImp.getContacts()== null) {
                transitionsBeanImp.setContacts(false);
            }
            
            TransitionsBeanImp tbdate = new TransitionsBeanImp();
            Date cieliddate = new Date();
            tbdate = implementationShared.UpdateStatusDocumentsContacts(transitionBeanM.getId(), transitionsBeanImp.getContacts(), fecha, dateBean.getContactsdate());
            transitionsBeanImp.setContactsdate(tbdate.getContactsdate());

            setDateStatusTransitionsBean(implementationShared.GetDateOfStatusTransitions(transitionBeanM.getId()));
            setTransitionsBeanImp(implementationShared.GetAllRestInforT_transition(transitionBeanM.getId()));
            dateBean = implementationShared.GetFechaOfStatusTransitions(transitionBeanM.getId());

            execute();

        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        return SUCCESS;
    }
    
    public String InsertVoboCheckBox3() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            TransitionShared transitionShared = new TransitionShared();
            ImplementationShared implementationShared = new ImplementationShared();

            setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
            AsignIfownerStkBean hghg = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
            if (hghg != null) {
                setCorreoIfOwnerInfo(hghg.getIfownwer());
            }

            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;

            setJoindocumenttransitionBeanT1(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 1));
            setJoindocumenttransitionBeanT2(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 2));
            setJoindocumenttransitionBeanT3(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 3));
            setJoindocumenttransitionBeanT4(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 4));
            setJoindocumenttransitionBeanT5(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 5));
            setJoindocumenttransitionBeanT6(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 6));
            setJoindocumenttransitionBeanT7(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 7));
            setJoindocumenttransitionBeanT8(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 8));

            Date myfechamehodDate = transitionShared.GetTheDateTime();
            DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
            //myfechamehodDate= dateFormat.format(myfechamehodDate);  
            String fecha = dateFormat.format(myfechamehodDate);


            if (transitionsBeanImp.getReporting()== null) {
                transitionsBeanImp.setReporting(false);
            }
            
            TransitionsBeanImp tbdate = new TransitionsBeanImp();
            Date cieliddate = new Date();
            tbdate = implementationShared.UpdateStatusDocumentsReporting(transitionBeanM.getId(), transitionsBeanImp.getReporting(), fecha, dateBean.getReportingdate());
            transitionsBeanImp.setReportingdate(tbdate.getReportingdate());

            setDateStatusTransitionsBean(implementationShared.GetDateOfStatusTransitions(transitionBeanM.getId()));
            setTransitionsBeanImp(implementationShared.GetAllRestInforT_transition(transitionBeanM.getId()));
            dateBean = implementationShared.GetFechaOfStatusTransitions(transitionBeanM.getId());

            execute();

        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        return SUCCESS;
    }
    
    public String InsertVoboCheckBox4() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            TransitionShared transitionShared = new TransitionShared();
            ImplementationShared implementationShared = new ImplementationShared();

            setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
            AsignIfownerStkBean hghg = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
            if (hghg != null) {
                setCorreoIfOwnerInfo(hghg.getIfownwer());
            }

            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;

            setJoindocumenttransitionBeanT1(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 1));
            setJoindocumenttransitionBeanT2(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 2));
            setJoindocumenttransitionBeanT3(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 3));
            setJoindocumenttransitionBeanT4(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 4));
            setJoindocumenttransitionBeanT5(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 5));
            setJoindocumenttransitionBeanT6(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 6));
            setJoindocumenttransitionBeanT7(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 7));
            setJoindocumenttransitionBeanT8(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 8));

            Date myfechamehodDate = transitionShared.GetTheDateTime();
            DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
            //myfechamehodDate= dateFormat.format(myfechamehodDate);  
            String fecha = dateFormat.format(myfechamehodDate);


            if (transitionsBeanImp.getScopeofservice()== null) {
                transitionsBeanImp.setScopeofservice(false);
            }
            
            TransitionsBeanImp tbdate = new TransitionsBeanImp();
            Date cieliddate = new Date();
            tbdate = implementationShared.UpdateStatusDocumentsSos(transitionBeanM.getId(), transitionsBeanImp.getScopeofservice(), fecha, dateBean.getScopeofservicedate());
            transitionsBeanImp.setScopeofservicedate(tbdate.getScopeofservicedate());

            setDateStatusTransitionsBean(implementationShared.GetDateOfStatusTransitions(transitionBeanM.getId()));
            setTransitionsBeanImp(implementationShared.GetAllRestInforT_transition(transitionBeanM.getId()));
            dateBean = implementationShared.GetFechaOfStatusTransitions(transitionBeanM.getId());

            execute();

        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        return SUCCESS;
    }
    
    public String InsertVoboCheckBox5() {
        
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            TransitionShared transitionShared = new TransitionShared();
            ImplementationShared implementationShared = new ImplementationShared();

            setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
            AsignIfownerStkBean hghg = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
            if (hghg != null) {
                setCorreoIfOwnerInfo(hghg.getIfownwer());
            }

            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;

            setJoindocumenttransitionBeanT1(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 1));
            setJoindocumenttransitionBeanT2(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 2));
            setJoindocumenttransitionBeanT3(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 3));
            setJoindocumenttransitionBeanT4(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 4));
            setJoindocumenttransitionBeanT5(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 5));
            setJoindocumenttransitionBeanT6(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 6));
            setJoindocumenttransitionBeanT7(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 7));
            setJoindocumenttransitionBeanT8(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 8));

            Date myfechamehodDate = transitionShared.GetTheDateTime();
            DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
            //myfechamehodDate= dateFormat.format(myfechamehodDate);  
            String fecha = dateFormat.format(myfechamehodDate);


            if (transitionsBeanImp.getCondition()== null) {
                transitionsBeanImp.setCondition(false);
            }
            
            TransitionsBeanImp tbdate = new TransitionsBeanImp();
            Date cieliddate = new Date();
            tbdate = implementationShared.UpdateStatusDocumentsConditions(transitionBeanM.getId(), transitionsBeanImp.getCondition(), fecha, dateBean.getConditionsdate());
            transitionsBeanImp.setConditionsdate(tbdate.getConditionsdate());

            setDateStatusTransitionsBean(implementationShared.GetDateOfStatusTransitions(transitionBeanM.getId()));
            setTransitionsBeanImp(implementationShared.GetAllRestInforT_transition(transitionBeanM.getId()));
            dateBean = implementationShared.GetFechaOfStatusTransitions(transitionBeanM.getId());

            execute();

        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        return SUCCESS;
    }
    
    public String InsertVoboCheckBox6() {
        
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            TransitionShared transitionShared = new TransitionShared();
            ImplementationShared implementationShared = new ImplementationShared();

            setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
            AsignIfownerStkBean hghg = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
            if (hghg != null) {
                setCorreoIfOwnerInfo(hghg.getIfownwer());
            }

            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;

            setJoindocumenttransitionBeanT1(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 1));
            setJoindocumenttransitionBeanT2(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 2));
            setJoindocumenttransitionBeanT3(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 3));
            setJoindocumenttransitionBeanT4(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 4));
            setJoindocumenttransitionBeanT5(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 5));
            setJoindocumenttransitionBeanT6(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 6));
            setJoindocumenttransitionBeanT7(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 7));
            setJoindocumenttransitionBeanT8(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 8));

            Date myfechamehodDate = transitionShared.GetTheDateTime();
            DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
            //myfechamehodDate= dateFormat.format(myfechamehodDate);  
            String fecha = dateFormat.format(myfechamehodDate);


                       if (transitionsBeanImp.getCielqmodule() == null) {
                transitionsBeanImp.setCielqmodule(false);
            }

            TransitionsBeanImp tbdate = new TransitionsBeanImp();
            Date cielQMdate = new Date();
            DateFormat dateFormatCQL = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
            String fechaCielQM = dateFormatCQL.format(cielQMdate);

            tbdate = implementationShared.UpdateStatusDocumentsCielQ(transitionBeanM.getId(), transitionsBeanImp.getCielqmodule(), fechaCielQM, dateBean.getCielqmoduledate());
            transitionsBeanImp.setCielqmoduledate(tbdate.getCielqmoduledate());

            setDateStatusTransitionsBean(implementationShared.GetDateOfStatusTransitions(transitionBeanM.getId()));
            setTransitionsBeanImp(implementationShared.GetAllRestInforT_transition(transitionBeanM.getId()));
            dateBean = implementationShared.GetFechaOfStatusTransitions(transitionBeanM.getId());

            execute();

        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        return SUCCESS;
    }
    
    public String InsertVoboCheckBox7() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            TransitionShared transitionShared = new TransitionShared();
            ImplementationShared implementationShared = new ImplementationShared();

            setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
            AsignIfownerStkBean hghg = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
            if (hghg != null) {
                setCorreoIfOwnerInfo(hghg.getIfownwer());
            }

            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;

            setJoindocumenttransitionBeanT1(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 1));
            setJoindocumenttransitionBeanT2(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 2));
            setJoindocumenttransitionBeanT3(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 3));
            setJoindocumenttransitionBeanT4(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 4));
            setJoindocumenttransitionBeanT5(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 5));
            setJoindocumenttransitionBeanT6(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 6));
            setJoindocumenttransitionBeanT7(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 7));
            setJoindocumenttransitionBeanT8(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 8));

            Date myfechamehodDate = transitionShared.GetTheDateTime();
            DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
            //myfechamehodDate= dateFormat.format(myfechamehodDate);  
            String fecha = dateFormat.format(myfechamehodDate);


            if (transitionsBeanImp.getCarriercc() == null) {
                transitionsBeanImp.setCarriercc(false);
            }

            TransitionsBeanImp tbdate = new TransitionsBeanImp();

            Date dateCarrier = new Date();
            DateFormat dateFormatDateCarri = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
            String fechaDatecarri = dateFormatDateCarri.format(dateCarrier);

            tbdate = implementationShared.UpdateStatusDocumentsCarrier(transitionBeanM.getId(), transitionsBeanImp.getCarriercc(), fechaDatecarri, dateBean.getCarrierccdate());
            transitionsBeanImp.setCarrierccdate(tbdate.getCarrierccdate());

            setDateStatusTransitionsBean(implementationShared.GetDateOfStatusTransitions(transitionBeanM.getId()));
            setTransitionsBeanImp(implementationShared.GetAllRestInforT_transition(transitionBeanM.getId()));
            dateBean = implementationShared.GetFechaOfStatusTransitions(transitionBeanM.getId());

            execute();

        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        return SUCCESS;
    }
    
    public String InsertVoboCheckBox8() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            TransitionShared transitionShared = new TransitionShared();
            ImplementationShared implementationShared = new ImplementationShared();

            setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
            AsignIfownerStkBean hghg = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
            if (hghg != null) {
                setCorreoIfOwnerInfo(hghg.getIfownwer());
            }

            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;

            setJoindocumenttransitionBeanT1(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 1));
            setJoindocumenttransitionBeanT2(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 2));
            setJoindocumenttransitionBeanT3(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 3));
            setJoindocumenttransitionBeanT4(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 4));
            setJoindocumenttransitionBeanT5(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 5));
            setJoindocumenttransitionBeanT6(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 6));
            setJoindocumenttransitionBeanT7(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 7));
            setJoindocumenttransitionBeanT8(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 8));

            Date myfechamehodDate = transitionShared.GetTheDateTime();
            DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
            //myfechamehodDate= dateFormat.format(myfechamehodDate);  
            String fecha = dateFormat.format(myfechamehodDate);


            if (transitionsBeanImp.getWorkingst()== null) {
                transitionsBeanImp.setWorkingst(false);
            }
            
            TransitionsBeanImp tbdate = new TransitionsBeanImp();
            Date cieliddate = new Date();
            tbdate = implementationShared.UpdateStatusDocumentsWorking(transitionBeanM.getId(), transitionsBeanImp.getWorkingst(), fecha, dateBean.getWorkingstdate());
            transitionsBeanImp.setWorkingstdate(tbdate.getWorkingstdate());

            setDateStatusTransitionsBean(implementationShared.GetDateOfStatusTransitions(transitionBeanM.getId()));
            setTransitionsBeanImp(implementationShared.GetAllRestInforT_transition(transitionBeanM.getId()));
            dateBean = implementationShared.GetFechaOfStatusTransitions(transitionBeanM.getId());

            execute();

        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        return SUCCESS;
    }
    
    public String InsertVoboCheckBox9() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            TransitionShared transitionShared = new TransitionShared();
            ImplementationShared implementationShared = new ImplementationShared();

            setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
            AsignIfownerStkBean hghg = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
            if (hghg != null) {
                setCorreoIfOwnerInfo(hghg.getIfownwer());
            }

            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;

            setJoindocumenttransitionBeanT1(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 1));
            setJoindocumenttransitionBeanT2(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 2));
            setJoindocumenttransitionBeanT3(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 3));
            setJoindocumenttransitionBeanT4(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 4));
            setJoindocumenttransitionBeanT5(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 5));
            setJoindocumenttransitionBeanT6(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 6));
            setJoindocumenttransitionBeanT7(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 7));
            setJoindocumenttransitionBeanT8(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 8));

            Date myfechamehodDate = transitionShared.GetTheDateTime();
            DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
            //myfechamehodDate= dateFormat.format(myfechamehodDate);  
            String fecha = dateFormat.format(myfechamehodDate);


            if (transitionsBeanImp.getSop()== null) {
                transitionsBeanImp.setSop(false);
            }
            
            TransitionsBeanImp tbdate = new TransitionsBeanImp();
            Date cieliddate = new Date();
            tbdate = implementationShared.UpdateStatusDocumentsSop(transitionBeanM.getId(), transitionsBeanImp.getSop(), fecha, dateBean.getSopdate());
            transitionsBeanImp.setSopdate(tbdate.getSopdate());

            setDateStatusTransitionsBean(implementationShared.GetDateOfStatusTransitions(transitionBeanM.getId()));
            setTransitionsBeanImp(implementationShared.GetAllRestInforT_transition(transitionBeanM.getId()));
            dateBean = implementationShared.GetFechaOfStatusTransitions(transitionBeanM.getId());

            execute();

        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        return SUCCESS;
    }
    
    public String InsertVoboCheckBox10() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            TransitionShared transitionShared = new TransitionShared();
            ImplementationShared implementationShared = new ImplementationShared();

            setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
            AsignIfownerStkBean hghg = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
            if (hghg != null) {
                setCorreoIfOwnerInfo(hghg.getIfownwer());
            }

            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;

            setJoindocumenttransitionBeanT1(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 1));
            setJoindocumenttransitionBeanT2(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 2));
            setJoindocumenttransitionBeanT3(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 3));
            setJoindocumenttransitionBeanT4(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 4));
            setJoindocumenttransitionBeanT5(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 5));
            setJoindocumenttransitionBeanT6(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 6));
            setJoindocumenttransitionBeanT7(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 7));
            setJoindocumenttransitionBeanT8(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 8));

            Date myfechamehodDate = transitionShared.GetTheDateTime();
            DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
            //myfechamehodDate= dateFormat.format(myfechamehodDate);  
            String fecha = dateFormat.format(myfechamehodDate);


            if (transitionsBeanImp.getKpi()== null) {
                transitionsBeanImp.setKpi(false);
            }
            
            TransitionsBeanImp tbdate = new TransitionsBeanImp();
            Date cieliddate = new Date();
            tbdate = implementationShared.UpdateStatusDocumentsKpi(transitionBeanM.getId(), transitionsBeanImp.getKpi(), fecha, dateBean.getKpidate());
            transitionsBeanImp.setKpidate(tbdate.getKpidate());

            setDateStatusTransitionsBean(implementationShared.GetDateOfStatusTransitions(transitionBeanM.getId()));
            setTransitionsBeanImp(implementationShared.GetAllRestInforT_transition(transitionBeanM.getId()));
            dateBean = implementationShared.GetFechaOfStatusTransitions(transitionBeanM.getId());

            execute();

        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        return SUCCESS;
    }
    
    public String InsertVoboCheckBox11() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            TransitionShared transitionShared = new TransitionShared();
            ImplementationShared implementationShared = new ImplementationShared();

            setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
            AsignIfownerStkBean hghg = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
            if (hghg != null) {
                setCorreoIfOwnerInfo(hghg.getIfownwer());
            }

            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;

            setJoindocumenttransitionBeanT1(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 1));
            setJoindocumenttransitionBeanT2(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 2));
            setJoindocumenttransitionBeanT3(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 3));
            setJoindocumenttransitionBeanT4(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 4));
            setJoindocumenttransitionBeanT5(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 5));
            setJoindocumenttransitionBeanT6(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 6));
            setJoindocumenttransitionBeanT7(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 7));
            setJoindocumenttransitionBeanT8(implementationShared.GetStatusFechaArchivoFromJoindocumenttransition(transitionBeanM.getId(), 8));

            Date myfechamehodDate = transitionShared.GetTheDateTime();
            DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
            //myfechamehodDate= dateFormat.format(myfechamehodDate);  
            String fecha = dateFormat.format(myfechamehodDate);


            if (transitionsBeanImp.getBilling()== null) {
                transitionsBeanImp.setBilling(false);
            }
            
            TransitionsBeanImp tbdate = new TransitionsBeanImp();
            Date cieliddate = new Date();
            tbdate = implementationShared.UpdateStatusDocumentsBilling(transitionBeanM.getId(), transitionsBeanImp.getBilling(), fecha, dateBean.getBillingdate());
            transitionsBeanImp.setBillingdate(tbdate.getBillingdate());

            setDateStatusTransitionsBean(implementationShared.GetDateOfStatusTransitions(transitionBeanM.getId()));
            setTransitionsBeanImp(implementationShared.GetAllRestInforT_transition(transitionBeanM.getId()));
            dateBean = implementationShared.GetFechaOfStatusTransitions(transitionBeanM.getId());

            execute();

        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        return SUCCESS;
    }

}
